package com.wp.controller;

import com.wp.pojo.Admin;
import com.wp.pojo.basePojo.SysResult;
import com.wp.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin")
@CrossOrigin
public class AdminController {
    @Autowired
    private AdminService adminService;
    //登录
    @PostMapping("login")
    public SysResult login(@RequestBody Admin admin){
        
        String token= adminService.login(admin);
        if(token==null){
            return SysResult.fail("用户名或密码错误");
        }
        return SysResult.success(token);
    }
}